package com.jlrdb.service;

import com.jlrdb.DAO.TvBroadcastDAO;
import com.jlrdb.DAO.TvBroadcastDAOImpl;
import com.jlrdb.model.TvBroadcast;
import com.jlrdb.model.TvBroadcasts;

public class TvBroadcastService {
	public int addTvBroadcast(TvBroadcast tvBroadcast) {
		TvBroadcastDAO tvBroadcastDAO = new TvBroadcastDAOImpl();
		int result = tvBroadcastDAO.addTvBroadcast(tvBroadcast);
		return result;
	}

	public TvBroadcast getThisBroadcast(long broadcastId) {
		TvBroadcastDAO tvBroadcastDAO = new TvBroadcastDAOImpl();
		TvBroadcast tvBroadcast = new TvBroadcast();
		tvBroadcast = tvBroadcastDAO.getThisBroadcast(broadcastId);
		return tvBroadcast;
	}

	public int updateTvBroadcast(TvBroadcast tvBroadcast, long broadcastId) {
		TvBroadcastDAO tvBroadcastDAO = new TvBroadcastDAOImpl();
		int result = tvBroadcastDAO.updateTvBroadcast(tvBroadcast, broadcastId);
		return result;
	}

	public TvBroadcast checkEmptyValues(TvBroadcast tvBroadcast) {
		if (tvBroadcast.getDtt_Standard().length() == 0)
			tvBroadcast.setDtt_Standard("Not Known");
		if (tvBroadcast.getDtt_Status().length() == 0)
			tvBroadcast.setDtt_Status("Not Known");
		if (tvBroadcast.getAnalog_Standard().length() == 0)
			tvBroadcast.setAnalog_Standard("Not Known");
		if (tvBroadcast.getAso_Date_Start().length() == 0)
			tvBroadcast.setAso_Date_Start("Not Known");
		if (tvBroadcast.getAso_Date_Completion().length() == 0)
			tvBroadcast.setAso_Date_Completion("Not Known");
		if (tvBroadcast.getAso_Status().length() == 0)
			tvBroadcast.setAso_Status("Not Known");
		if (tvBroadcast.getDso_Date_Start().length() == 0)
			tvBroadcast.setDso_Date_Start("Not Known");
		if (tvBroadcast.getDso_Date_Completion().length() == 0)
			tvBroadcast.setDso_Date_Completion("Not Known");
		if (tvBroadcast.getDso_Status().length() == 0)
			tvBroadcast.setDso_Status("Not Known");
		if (tvBroadcast.getNext_Transition_Planned().length() == 0)
			tvBroadcast.setNext_Transition_Planned("Not Known");
		if (tvBroadcast.getStandard_Transition_Into().length() == 0)
			tvBroadcast.setStandard_Transition_Into("Not Known");
		if (tvBroadcast.getStatus().length() == 0)
			tvBroadcast.setStatus("Not Known");
		if (tvBroadcast.getStart_Date().length() == 0)
			tvBroadcast.setStart_Date("Not Known");
		if (tvBroadcast.getNotes().length() == 0)
			tvBroadcast.setNotes("-");
		if (tvBroadcast.getStatus_Confirmed().length() == 0)
			tvBroadcast.setStatus_Confirmed("Not Known");
		if (tvBroadcast.getLast_Date_Verified().length() == 0)
			tvBroadcast.setLast_Date_Verified("Not Known");
		if (tvBroadcast.getVideo_Format_Supported().length() == 0)
			tvBroadcast.setVideo_Format_Supported("Not Known");
		if (tvBroadcast.getOperators().length() == 0)
			tvBroadcast.setOperators("Not Known");
		if (tvBroadcast.getMux_Details().length() == 0)
			tvBroadcast.setMux_Details("Not Known");
		if (tvBroadcast.getDtt_Coverage().length() == 0)
			tvBroadcast.setDtt_Coverage("Not Known");
		if (tvBroadcast.getHd_Present().length() == 0)
			tvBroadcast.setHd_Present("Not Known");
		if (tvBroadcast.getAudio_Formats().length() == 0)
			tvBroadcast.setAudio_Formats("Not Known");
		if (tvBroadcast.getInteractive_Standards().length() == 0)
			tvBroadcast.setInteractive_Standards("Not Known");
		if (tvBroadcast.getFrequency_Bands().length() == 0)
			tvBroadcast.setFrequency_Bands("Not Known");
		if (tvBroadcast.getChannel_Bandwidth().length() == 0)
			tvBroadcast.setChannel_Bandwidth("Not Known");
		if (tvBroadcast.getCarrier_Type().length() == 0)
			tvBroadcast.setCarrier_Type("Not Known");
		if (tvBroadcast.getModulation().length() == 0)
			tvBroadcast.setModulation("Not Known");
		if (tvBroadcast.getBroadcast_Authority().length() == 0)
			tvBroadcast.setBroadcast_Authority("Not Known");
		if (tvBroadcast.getItu_Region().length() == 0)
			tvBroadcast.setItu_Region("Not Known");
		if (tvBroadcast.getBroadcasters().length() == 0)
			tvBroadcast.setBroadcasters("Not Known");
		if (tvBroadcast.getSource_Of_Reference().length() == 0)
			tvBroadcast.setSource_Of_Reference("-");
		return tvBroadcast;
	}

	public TvBroadcasts viewTvBroadcastsNew(TvBroadcast tvQuery) {
		TvBroadcastDAO tvBroadcastDAO = new TvBroadcastDAOImpl();
		TvBroadcasts tvBroadcasts = new TvBroadcasts();
		tvBroadcasts = tvBroadcastDAO.viewTvBroadcastNew(tvQuery);
		return tvBroadcasts;
	}
}
